<?php
/**
 * Created by PhpStorm.
 * User: zng
 * Date: 2020/3/25
 * Time: 11:07
 */
namespace app\api\service\foods;

use app\api\model\foods\FoodCategory as FoodCategoryModels;

Class FoodCategory {

    /**
     * 根据菜品分类获取菜品列表
     *
     * @return mixed
     */
    public function lists()
    {
        return FoodCategoryModels::with(['foods'=>function($query){
            $query->with(['shoppingCart'])->where('stock', '>', 0)->order('sort_num', 'asc');
        }])->order('sort_num', 'asc')->selectOrFail();
    }

}